"""
设计三个类：Xiaotianquan、Dog、Animal
关系：        孙子       儿子   父亲
"""


class Animal(object):
    def __init__(self, name):
        self.name = name

    def eat(self):
        print("吃---")

    def drink(self):
        print("喝---")

    def run(self):
        print("跑---")

    def sleep(self):
        print("睡---")


class Dog(Animal):  # 括号内的是其父类
    def __init__(self, name, color):
        self.color = color
        super().__init__(name)
        # super()表示父类的实例对象
        # 子类对象调用父亲的init

    def bark(self):
        print(f'{self.name}汪汪叫{self.color}--')

    def run(self):
        super().run()
        print(f'{self.name}跑的快')


class Xiaotianquan(Dog):  # 括号内的是其父类
    def __init__(self, name, color, age):
        self.age = age
        super().__init__(name, color)

    def fly(self):
        print(f'{self.name}飞天--{self.color}--{self.age}')


if __name__ == '__main__':
    wangcai = Dog('旺财', '黄色')
    wangcai.bark()
    wangcai.run()
    xiaotianquan = Xiaotianquan('哮天犬', '黑色', 20)
    xiaotianquan.fly()

    print(Xiaotianquan.__mro__)
    # 类名.__mro__：打印出类的调用顺序，即类的“亲属关系”
    # (<class '__main__.Xiaotianquan'>, <class '__main__.Dog'>, <class '__main__.Animal'>, <class 'object'>)
